<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
       	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
	   	http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context-2.5.xsd">

	<!-- Datenbank -->
	<!-- bean id="datasource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="org.h2.Driver" />
		<property name="url" value="jdbc:h2:tcp://localhost/kiltz" />
		<property name="username" value="sa" />
		<property name="password" value="" />
	</bean -->

	<bean id="datasource"
		class="com.mchange.v2.c3p0.ComboPooledDataSource"
		destroy-method="close">
		<property name="driverClass" value="com.mysql.jdbc.Driver" />
		<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/kiltz" />
		<property name="user" value="root" />
		<property name="password" value="" />
		<property name="minPoolSize" value="2" />
      	<property name="maxPoolSize" value="4" />
	</bean>
	
	<!-- Hibernate -->
	<bean id="hibernateSessionFactory"
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="annotatedClasses">
            <list>
                <value>de.kiltz.foo.domain.Foo</value>
            </list>
        </property>		
        <property name="hibernateProperties">
			<props>
<!--				<prop key="hibernate.dialect">-->
<!--					org.hibernate.dialect.H2Dialect-->
<!--				</prop>-->
				<prop key="hibernate.dialect">
					org.hibernate.dialect.MySQLDialect
				</prop>
				<!-- Zeige SQL-Statements -->
				<prop key="hibernate.show_sql">true</prop>

				<!-- Erzeuge die Tabellen bei Bedarf -->
				<prop key="hibernate.hbm2ddl.auto">update</prop>

			</props>
		</property>
		<property name="dataSource" ref="datasource" />
	</bean>

	<!-- Transaction -->
	<tx:annotation-driven transaction-manager="txManager"/>
	<!-- Der Transaktionsmanager -->
	<bean id="txManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>

</beans>